from pathlib import Path

import yaml  # pyyaml
import os

f = open("../config/data.yaml", mode='r', encoding="utf-8")
data = yaml.safe_load(f)
# print(data)
print(data['hero'])
print(data['heros_name'])
print(data['heros'])
print(data['heros_name_list'])


def get_data():
    # __file__：Python 内置变量，表示 当前文件的绝对路径（例如：/project/src/utils.py
    # 这个到其他文件，目录就会改变了，所以需要调整
    f = open("D:/软件测试/ApiTest/config/data.yaml", mode='r', encoding="utf-8")
    data = yaml.safe_load(f)
    return data

if __name__ == '__main__':
    get_data()